package gameLogic;

import java.util.ArrayList;
import java.util.Iterator;

public abstract class EventGenerator {
	ArrayList<EventHandler> handlerList;
	
	EventGenerator() {
		handlerList = new ArrayList<EventHandler>();
	}
	
	void addEventHandler(EventHandler eh) {
		handlerList.add(eh);
	}
	
	void removeEventHander(EventHandler eh) {
		handlerList.remove(eh);
	}
	
	void generateEvent(Object arg) {
		Iterator<EventHandler> handlers = handlerList.iterator();
		while(handlers.hasNext()) {
			handlers.next().actionPerformed(arg);
		}
	}
}
